package com.alibaba.citrus.ots.platform.enhance.sdo;

import lombok.Getter;
import lombok.Setter;

import java.util.Arrays;

/**
 * @author:suqing.tjf
 * @date:2021/10/20
 */
public enum RoleCodeEnum {

    SALE_MAN("001","业务员"),

    DEPARTMENT_MANAGER("002","部门经理"),

    CHANNEL_MANAGER("003","渠道经理"),

    PLAN_DISPATCHER("004","计划调度员"),

    GENERAL_MANAGER("005", "总经理");

    @Getter
    @Setter
    private String code;

    @Getter
    @Setter
    private String desc;

    RoleCodeEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static RoleCodeEnum of(String code) {
        if (code == null) {
            return null;
        }
        return Arrays.stream(RoleCodeEnum.values()).filter(source -> code.equals(source.code)).findFirst().orElse(null);
    }
}
